import instance from "@/utils/request"
import type {
  LoginUser,
  RegisterUser,
  LoginResponse,
  UserInfo,
} from "@/types/data"
export const register = (data: RegisterUser) =>
  instance("/user/register", "post", data)

export const login = (data: LoginUser) => {
  return instance<LoginResponse>("/user/login", "post", data)
}

export const getUserInfo = () => {
  return instance<UserInfo>("/user/currentUser", "get")
}

export const logout = () => {
  return instance("/user/logout")
}
